﻿

using System;
using System.Collections.Generic;
using System.Web;
using System.Data;


    public class count
    {
        // Methods
        public static string counts(string str, string str1, string str2, string str3)
        {
            string sql = "select * from " + str1 + " where " + str2 + "=" + str3 + "";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            str = table.Rows.Count.ToString();
            if (str.Trim().ToString() == "")
            {
                str = "0";
            }
            return str.Trim();
        }

        public static string countsa(string str, string str1, string str2)
        {
            string sql = "select sum(" + str2 + ") from " + str1 + " where protype=0";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            str = table.Rows[0][0].ToString();
            if (str.Trim().ToString() == "")
            {
                str = "0";
            }
            return str.Trim();
        }

        public static string countsb(string str, string str1, string str2, string str3, string str4, string str5)
        {
            string sql = "select * from " + str1 + " where " + str2 + "=" + str3 + " and " + str4 + "=" + str5 + "";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            str = table.Rows.Count.ToString();
            if (str.Trim().ToString() == "")
            {
                str = "0";
            }
            return str.Trim();
        }

    }
